package view;

import indexingSystem.IndexingDatabase;
import indexingSystem.Logger;
import java.sql.ResultSet;

public class ViewFrequency implements View{
	public void show() { 
		System.out.print("something");
		try {
			ResultSet r = IndexingDatabase.getInterface().queryDB("SELECT word, frequency " +
																  "FROM word " +
																  "ORDER BY frequency");
		
			while(!r.isLast()){
				String word = r.getString(1);
				String frequency = r.getString(2);
				Logger.getLog().addReport(word + " " + frequency);
				r.next();
			}
		} catch (Exception e) {
			Logger.getLog().addError(e.getMessage());
		}
	}
	public String getCommandName(){
		return "frequency";
	}
}
